package com.atguigu.tingshu.account;

import com.atguigu.tingshu.account.impl.AccountDegradeFeignClient;
import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.vo.account.AccountDeductVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * <p>
 * 账号模块远程调用API接口
 * </p>
 *
 * @author atguigu
 */
@FeignClient(value = "service-account", path ="api/account" , fallback = AccountDegradeFeignClient.class)
public interface AccountFeignClient {

    /**
     * 检查余额及扣减余额
     * TODO:根虚拟物品发货接口保持一致，用户ID通过入参对象传递。
     *		 将来采用微信/支付宝支付后，支付宝会有支付成功回调 -> 请求商户系统不会携带Token访问
     * @param accountDeductVo 订单编号、扣减金额、购买内容、用户Id
     * @return
     */
    @PostMapping("/userAccount/checkAndDeduct")
    public Result checkAndDeduct(@RequestBody AccountDeductVo accountDeductVo);
}
